 package tools.data.input;

 import java.awt.Point;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;







 public class GenericLittleEndianAccessor
   implements LittleEndianAccessor
 {
/*  16 */   private static final Logger log = LogManager.getLogger(GenericLittleEndianAccessor.class);




   private final ByteInputStream bs;





   public GenericLittleEndianAccessor(ByteInputStream bs) {
/*  28 */     this.bs = bs;
   }


   public int readByteAsInt() {
/*  33 */     return this.bs.readByte();
   }








   public byte readByte() {
/*  44 */     return (byte)this.bs.readByte();
   }







   public int readInt() {
/*  54 */     int byte1 = this.bs.readByte();
/*  55 */     int byte2 = this.bs.readByte();
/*  56 */     int byte3 = this.bs.readByte();
/*  57 */     int byte4 = this.bs.readByte();
/*  58 */     return (byte4 << 24) + (byte3 << 16) + (byte2 << 8) + byte1;
   }







   public short readShort() {
/*  68 */     int byte1 = this.bs.readByte();
/*  69 */     int byte2 = this.bs.readByte();
/*  70 */     return (short)((byte2 << 8) + byte1);
   }







   public int readUShort() {
/*  80 */     int quest = readShort();
/*  81 */     if (quest < 0) {
/*  82 */       quest += 65536;
     }
/*  84 */     return quest;
   }







   public char readChar() {
/*  94 */     return (char)readShort();
   }







   public long readLong() {
/* 104 */     long byte1 = this.bs.readByte();
/* 105 */     long byte2 = this.bs.readByte();
/* 106 */     long byte3 = this.bs.readByte();
/* 107 */     long byte4 = this.bs.readByte();
/* 108 */     long byte5 = this.bs.readByte();
/* 109 */     long byte6 = this.bs.readByte();
/* 110 */     long byte7 = this.bs.readByte();
/* 111 */     long byte8 = this.bs.readByte();
/* 112 */     return (byte8 << 56L) + (byte7 << 48L) + (byte6 << 40L) + (byte5 << 32L) + (byte4 << 24L) + (byte3 << 16L) + (byte2 << 8L) + byte1;
   }







   public float readFloat() {
/* 122 */     return Float.intBitsToFloat(readInt());
   }







   public double readDouble() {
/* 132 */     return Double.longBitsToDouble(readLong());
   }









   public String readAsciiString(int n) {
/* 144 */     byte[] ret = new byte[n];
/* 145 */     for (int x = 0; x < n; x++) {
/* 146 */       ret[x] = readByte();
     }
     try {
/* 149 */       return new String(ret, "gbk");
/* 150 */     } catch (Exception e) {
/* 151 */       log.error("readAsciiString", e);

/* 153 */       return "";
     }
   }







   public long getBytesRead() {
/* 164 */     return this.bs.getBytesRead();
   }








   public String readMapleAsciiString() {
/* 175 */     return readAsciiString(readShort());
   }








   public Point readPos() {
/* 186 */     int x = readShort();
/* 187 */     int y = readShort();
/* 188 */     return new Point(x, y);
   }


   public Point readPosAsInt() {
/* 193 */     int x = readInt();
/* 194 */     int y = readInt();
/* 195 */     return new Point(x, y);
   }









   public byte[] read(int num) {
/* 207 */     byte[] ret = new byte[num];
/* 208 */     for (int x = 0; x < num; x++) {
/* 209 */       ret[x] = readByte();
     }
/* 211 */     return ret;
   }








   public void skip(int num) {
/* 222 */     for (int x = 0; x < num; x++) {
/* 223 */       readByte();
     }
   }





   public long available() {
/* 232 */     return this.bs.available();
   }





   public String toString() {
/* 240 */     return this.bs.toString();
   }


   public String toString(boolean b) {
/* 245 */     return this.bs.toString(b);
   }
 }


/* Location:              C:\PGX\Server.jar!\tools\data\input\GenericLittleEndianAccessor.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */